package com.nbst;

import com.nbst.comnutil.DateUtil;
import com.nbst.comnutil.LogOut;
import com.nbst.comnutil.serverConf;

import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *
 * @ClassName: ApplicationStartup
 * @Description: 项目配置类
 * @author King
 * @date 2018-8-24
 *
 */
@Configuration
public class ApplicationStartup implements ApplicationListener<ApplicationReadyEvent>, WebMvcConfigurer {

	@Override
	public void onApplicationEvent(ApplicationReadyEvent event) {
		LogOut logout = event.getApplicationContext().getBean(LogOut.class); // 日志配置
		serverConf conf = event.getApplicationContext().getBean(serverConf.class); // 服务系统配置
		// 开始所有配置内容输出
		logout.info("----------------------  当前服务器配置  ----------------------");
		logout.info("应用名称：" + conf.getServername());
		logout.info("应用端口：" + conf.getPort());
		logout.info("系统启动时间为:" + DateUtil.date2String("yyyy-MM-dd HH:mm:ss"));

		logout.info("-----------------------  基本配置完成  ---------------------");
	}

}
